/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.uccart_project.model;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;


@Entity
@Table(name = "contrasenas")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Contrasenas.findAll", query = "SELECT c FROM Contrasenas c"),
    @NamedQuery(name = "Contrasenas.findByContPw", query = "SELECT c FROM Contrasenas c WHERE c.contPw = :contPw"),
    @NamedQuery(name = "Contrasenas.findByContIdestudiante", query = "SELECT c FROM Contrasenas c WHERE c.contIdestudiante = :contIdestudiante")})
public class Contrasenas implements Serializable {
    private static final long serialVersionUID = 1L;
    @Column(name = "cont_pw")
    private String contPw;
    @Id
    @Basic(optional = false)
    @Column(name = "cont_idestudiante")
    private String contIdestudiante;
    @JoinColumn(name = "cont_idestudiante", referencedColumnName = "est_id", insertable = false, updatable = false)
    @OneToOne(optional = false)
    private Estudiante estudiante;

    public Contrasenas() {
    }

    public Contrasenas(String contIdestudiante) {
        this.contIdestudiante = contIdestudiante;
    }

    public String getContPw() {
        return contPw;
    }

    public void setContPw(String contPw) {
        this.contPw = contPw;
    }

    public String getContIdestudiante() {
        return contIdestudiante;
    }

    public void setContIdestudiante(String contIdestudiante) {
        this.contIdestudiante = contIdestudiante;
    }

    public Estudiante getEstudiante() {
        return estudiante;
    }

    public void setEstudiante(Estudiante estudiante) {
        this.estudiante = estudiante;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (contIdestudiante != null ? contIdestudiante.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Contrasenas)) {
            return false;
        }
        Contrasenas other = (Contrasenas) object;
        if ((this.contIdestudiante == null && other.contIdestudiante != null) || (this.contIdestudiante != null && !this.contIdestudiante.equals(other.contIdestudiante))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.uccart_project.model.Contrasenas[ contIdestudiante=" + contIdestudiante + " ]";
    }
    
}
